    //
//  pageViewControll.m
//  NewsReaderPhone
//
//  Created by lang langhonglin on 10-8-18.
//  Copyright 2010 hgzp. All rights reserved.
//

#import "pageViewControll.h"


@implementation pageViewControll

@synthesize webView,urlString,articleview;


/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	NSString *path = urlString;
	NSURL *url = [NSURL URLWithString:path];
	webView.delegate = self;
    [webView loadRequest:[NSURLRequest requestWithURL:url]];
	// lableTitle.text = @"新闻";
	
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
	
		
}


-(IBAction) pageView {
	
	[[self parentViewController] dismissModalViewControllerAnimated:YES];
}

-(IBAction) listView {
	
}

-(void) LoadUrlString:(NSString *)str {
	
	NSString *path = str;
    NSURL *url = [NSURL URLWithString:path];
    [webView loadRequest:[NSURLRequest requestWithURL:url]];
	
}


-(void)  setUrlString:(NSString *)str {
	
	urlString = str;
}


- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
	
	//NSLog(@"load");
	//if (navigationType == UIWebViewNavigationTypeLinkClicked)
	//{
		
	/*	NSURL *url = request.URL;
		NSString *urlString = url.absoluteString;
		[self.articleview setUrlString:urlString];
		[self presentModalViewController:self.articleview animated:YES];*/
	//	[[ self parentViewController] dismissModalViewControllerAnimated:YES];

		//return NO;
		
	//}
	
	
	NSURL *url = request.URL;
	 NSString *urlString = url.absoluteString;
	 
	if ([urlString rangeOfString:@"login.aspx"].length > 0 
		|| [urlString rangeOfString:@"register.aspx"].length > 0 
		|| [urlString rangeOfString:@"mcounter.aspx"].length > 0
		|| [urlString rangeOfString:@"mPayOrder.aspx"].length > 0 
		|| [urlString rangeOfString:@"Calendar.aspx"].length > 0 
		|| [urlString rangeOfString:@"MenuOp.aspx"].length > 0 
		|| [urlString rangeOfString:@"PageList.aspx"].length > 0  )
		
	{
		//NSLog(@"pageview");
		//NSLog(urlString);
		
		return YES;

	}
	
	[[ self parentViewController] LoadUrlString:urlString];
	[[ self parentViewController] dismissModalViewControllerAnimated:YES];
	return YES;
}
	

-(IBAction) action_BankView {

	[[ self parentViewController] dismissModalViewControllerAnimated:YES];
}


-(IBAction) action_ReFresh{
 
 [webView reload];
	
}




- (void)dealloc {
    [super dealloc];
}


@end
